cleanups
authorØyvind Kolås <ok@src.gnome.org>
Tue, 9 Aug 2005 22:55:20 +0000 (22:55 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Tue, 9 Aug 2005 22:55:20 +0000 (22:55 +0000)
ChangeLog
autogen.sh
babl/babl-classes.h
babl/babl-fish.c
babl/babl-fish.h
babl/babl-ids.h
babl/babl-sampling.h

index 0e03bf8b9740c1539b8bf54694eb237d3227e3e4..309605fd643c1084dbe490ea13578a5cf1e57bb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-09  Øyvind Kolås  <pippin@gimp.org>
+
+       * autogen.sh: make autogen also run make
+       * babl/babl-classes.h: added define macro usable for sampling and
+       fish.
+       * babl/babl-fish.[ch]: cleanup of stub class
+       * babl/babl-sampling.h: simplification of header using a define.
+
 2005-09-09  Øyvind Kolås  <pippin@gimp.org>
 
        * babl/babl-conversion.c: indentation cleanup.
index 4db3def1d1c6fee6e77bbdd6d686630c90bf8849..c75f9da8a5adcce70490f4e3cf60f06961be6884 100755 (executable)
@@ -42,7 +42,9 @@ autoheader                    && \
 echo "- automake."             && \
 automake --add-missing --gnu   && \
 echo                           && \
-./configure "$@"               && exit 0
+./configure "$@"               && \
+echo                           && \
+make                            && exit 0
 
 exit 1
 
index 7adaa8858187fc0b8f80664edbf28fbd183d32b7..3b9fffeed0a1f9f626ecc6e1bdd059d3cd883633 100644 (file)
@@ -223,16 +223,26 @@ typedef int  (*BablEachFunction) (Babl *entry,
 
 const char  *babl_class_name     (BablClassType klass);
 
+
+
 #define BABL_DEFINE_CLASS(TypeName, type_name)                   \
                                                                  \
 void       type_name##_init       (void);                        \
+void       type_name##_destroy    (void);                        \
 void       type_name##_each       (BablEachFunction  each_fun,   \
                                    void             *user_data); \
-void       type_name##_destroy    (void);                        \
 TypeName * type_name              (const char       *name);      \
 TypeName * type_name##_id         (int               id);        \
 TypeName * type_name##_new        (const char       *name,       \
                                    ...);
 
+
+#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(TypeName, type_name)      \
+                                                                 \
+void       type_name##_init       (void);                        \
+void       type_name##_destroy    (void);                        \
+void       type_name##_each       (BablEachFunction  each_fun,   \
+                                   void             *user_data);
+
 #endif
 
index c6fca4f151bd2f81430b05f1c6323e3c0f5aed30..b0a3a30825d372d8ad9214868cf98351025b54d1 100644 (file)
@@ -27,87 +27,28 @@ static int
 each_babl_fish_destroy (Babl *babl,
                         void *data)
 {
-  babl_free (babl->instance.name);
   babl_free (babl);
   return 0;  /* continue iterating */
 }
 
-static BablFish *
-fish_new (const char              *name,
-                int                id,
-                Babl              *source,
-                Babl              *destination)
+BablFish *
+babl_fish_new (const char        *name,
+               Babl              *source,
+               Babl              *destination)
 {
   BablFish *self = NULL;
 
   self = babl_calloc (sizeof (BablFish), 1);
   self->instance.type = BABL_FISH;
 
-  self->instance.id   = id;
-  self->instance.name = babl_strdup (name);
+  self->instance.id   = 0;
+  self->instance.name = "Fishy";
   self->source        = (union Babl*)source;
   self->destination   = (union Babl*)destination;
 
   assert (BABL_IS_BABL (self->source));
   assert (BABL_IS_BABL (self->destination));
 
-/*  Might make sense to allow a precalculated shortcut to
- *  participate in later checks for optimal conversions
-  
-    babl_add_ptr_to_list ((void ***)&(source->type.from), self);
-    babl_add_ptr_to_list ((void ***)&(destination->type.to), self);
-  */
-  
-  return (BablFish*)self;
-}
-
-BablFish *
-babl_fish_new (const char *name,
-                     ...)
-{
-  va_list            varg;
-  BablFish    *self;
-
-  int                id          = 0;
-  Babl              *source      = NULL;
-  Babl              *destination = NULL;
-
-  const char        *arg         = name;
-
-  va_start (varg, name);
-  
-  while (1)
-    {
-      arg = va_arg (varg, char *);
-      if (!arg)
-        break;
-     
-      else if (!strcmp (arg, "id"))
-        {
-          id = va_arg (varg, int);
-        }
-
-      else if (!strcmp (arg, "source"))
-        {
-          source = va_arg (varg, Babl*);
-        }
-      else if (!strcmp (arg, "destination"))
-        {
-          destination = va_arg (varg, Babl*);
-        }
-      else
-        {
-          babl_log ("%s(): unhandled parameter '%s' for pixel_format '%s'",
-                    __FUNCTION__, arg, name);
-          exit (-1);
-        }
-    }
-    
-  va_end   (varg);
-
-  self = fish_new (name, id,
-                         source, destination);
-
   if ((BablFish*) db_insert ( (Babl*)self) == self)
     {
       return self;
@@ -117,6 +58,17 @@ babl_fish_new (const char *name,
       each_babl_fish_destroy ( (Babl*)self, NULL);
       return NULL;
     }
+
+/*  Might make sense to allow a precalculated shortcut to
+ *  participate in later checks for optimal conversions, then we
+ *  should also have better generated names,.   model + datatype 
+ *  is a possibility , or even full single line serialization of
+ *  components with types.
+ *
+    babl_add_ptr_to_list ((void ***)&(source->type.from), self);
+    babl_add_ptr_to_list ((void ***)&(destination->type.to), self);
+  */
+  return (BablFish*)self;
 }
 
 BABL_CLASS_TEMPLATE(BablFish, babl_fish, "BablFish")
index d3b0fe1797285e15843c6776799a49acf2bb4a3d..4ed0ada6f18dd334eaa2438e89fc575e21495e4f 100644 (file)
 #define BABL_FISH_H
 
 #include "babl-classes.h"
-BABL_DEFINE_CLASS(BablFish, babl_fish)
+
+BABL_DEFINE_CLASS_NO_NEW_NO_ID(BablFish, babl_fish)
+
+BablFish *
+babl_fish_new (Babl *source,
+               Babl *destination);
+  
+/* babl_fish_process will probably be a polymorph function
+ * accepting source and destination buffer pointers will be
+ * allowed as well as BablImage objects in their place
+ */
+int
+babl_fish_process        (BablFish *babl_fish,
+                          void     *source,
+                          void     *destination,
+                          int       n);
+
+/* whether the BablFish needs a BablImage to do the processing,
+ * or void * are sufficient.
+ */
+int
+babl_fish_needs_image (BablFish *babl_dish);
 
 #endif
index 62021215acafff790ed6eb0e3fe9389150533b66..2b284e36a0a20382e1b4b5209364256d250259fc 100644 (file)
@@ -35,6 +35,8 @@ enum {
   BABL_BLUE,
   BABL_ALPHA,
   BABL_LUMINANCE,
+  BABL_LUMINANCE_GAMMA_2_2,
+  BABL_LUMINANCE_MUL_ALPHA,
   BABL_RED_MUL_ALPHA,
   BABL_GREEN_MUL_ALPHA,
   BABL_BLUE_MUL_ALPHA,
@@ -58,16 +60,18 @@ enum {
 
   BABL_MODEL_BASE = 10000,
   BABL_RGB,
-  BABL_RGBA,
-  BABL_RGBA_PREMULTIPLIED,
   BABL_RGB_GAMMA_2_2,
+  BABL_RGBA,
   BABL_RGBA_GAMMA_2_2,
+  BABL_RGBA_PREMULTIPLIED,
   BABL_CMY,
   BABL_CMYK,
   BABL_CMYKA,
   BABL_YCBCR,
   BABL_GRAYSCALE,
+  BABL_GRAYSCALE_GAMMA_2_2,
   BABL_GRAYSCALE_ALPHA,
+  BABL_GRAYSCALE_ALPHA_PREMULTIPLIED,
 
   BABL_PIXEL_FORMAT_BASE = 100000,
   BABL_SRGB,
index 85d06af185274b41cbc9b361f5e1a66a1659c39f..5304c3f89cbe314ac24e1a6085b83db9f4725ce5 100644 (file)
 
 #include "babl-classes.h"
 
-void           babl_sampling_init       (void);
-void           babl_sampling_each       (BablEachFunction  each_fun,
-                                         void             *user_data);
-void           babl_sampling_destroy    (void);    
+BABL_DEFINE_CLASS_NO_NEW_NO_ID(BablSampling, babl_sampling)
 BablSampling * babl_sampling            (int horizontal,
                                          int vertical);
 #endif